{% extends "base.html" %}

{% block title %}发布设计案例 - {{ super() }}{% endblock %}

{% block content %}
<div class="container">
    <h1 class="mb-4">发布设计案例</h1>
    <form method="post" enctype="multipart/form-data">
        {{ form.csrf_token }}
        <div class="card">
            <div class="card-body">
                <div class="mb-3">
                    <label for="title" class="form-label">标题</label>
                    {{ form.title(class="form-control", placeholder="请输入案例标题") }}
                    {% if form.title.errors %}
                    <div class="invalid-feedback d-block">
                        {% for error in form.title.errors %}
                        <span>{{ error }}</span>
                        {% endfor %}
                    </div>
                    {% endif %}
                </div>

                <div class="mb-3">
                    <label for="category" class="form-label">分类</label>
                    {{ form.category(class="form-select") }}
                    {% if form.category.errors %}
                    <div class="invalid-feedback d-block">
                        {% for error in form.category.errors %}
                        <span>{{ error }}</span>
                        {% endfor %}
                    </div>
                    {% endif %}
                </div>

                <div class="mb-3">
                    <label for="description" class="form-label">简介</label>
                    {{ form.description(class="form-control", rows="3", placeholder="请输入案例简介") }}
                    {% if form.description.errors %}
                    <div class="invalid-feedback d-block">
                        {% for error in form.description.errors %}
                        <span>{{ error }}</span>
                        {% endfor %}
                    </div>
                    {% endif %}
                </div>

                <div class="mb-3">
                    <label for="content" class="form-label">详细内容</label>
                    {{ form.content(class="form-control", rows="10", placeholder="请输入案例详细内容") }}
                    {% if form.content.errors %}
                    <div class="invalid-feedback d-block">
                        {% for error in form.content.errors %}
                        <span>{{ error }}</span>
                        {% endfor %}
                    </div>
                    {% endif %}
                </div>

                <div class="mb-3">
                    <label for="cover_image" class="form-label">封面图片</label>
                    {{ form.cover_image(class="form-control") }}
                    {% if form.cover_image.errors %}
                    <div class="invalid-feedback d-block">
                        {% for error in form.cover_image.errors %}
                        <span>{{ error }}</span>
                        {% endfor %}
                    </div>
                    {% endif %}
                </div>

                <div class="mb-3">
                    <label for="images" class="form-label">案例图片（可多选）</label>
                    {{ form.images(class="form-control", multiple=true) }}
                    {% if form.images.errors %}
                    <div class="invalid-feedback d-block">
                        {% for error in form.images.errors %}
                        <span>{{ error }}</span>
                        {% endfor %}
                    </div>
                    {% endif %}
                </div>

                <div class="mb-3">
                    <label for="tags" class="form-label">标签</label>
                    {{ form.tags(class="form-control", placeholder="请输入标签，用逗号分隔") }}
                    {% if form.tags.errors %}
                    <div class="invalid-feedback d-block">
                        {% for error in form.tags.errors %}
                        <span>{{ error }}</span>
                        {% endfor %}
                    </div>
                    {% endif %}
                </div>
            </div>
            <div class="card-footer">
                <button type="submit" class="btn btn-primary">发布案例</button>
                <a href="{{ url_for('design.index') }}" class="btn btn-secondary">取消</a>
            </div>
        </div>
    </form>
</div>
{% endblock %} 